<!DOCTYPE html>
<html lang=zh>
<head><meta name="generator" content="Hexo 3.9.0">
    <!-- so meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="HandheldFriendly" content="True">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="description" content="前言需求是需要对放在测试服务器的 git 仓库定期做好备份，防止测试服务器有天挂掉了数据会丢失掉。假设现在有两台服务器–服务器 A 和服务器 B，A 和 B 在两个不同的网段，没法通过 ssh 或者 ftp 直接连接上。如何将放在 A 上的 git 仓库数据每隔一天备份并存储到 B 上? linux 定时脚本我使用的是crontab包，登录服务器 A，检查crontab并将crontab设置为开机">
<meta name="keywords" content="同花顺,linux">
<meta property="og:type" content="article">
<meta property="og:title" content="如何写一个定时执行的shell脚本">
<meta property="og:url" content="https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/index.html">
<meta property="og:site_name" content="月光倾城的代码小屋">
<meta property="og:description" content="前言需求是需要对放在测试服务器的 git 仓库定期做好备份，防止测试服务器有天挂掉了数据会丢失掉。假设现在有两台服务器–服务器 A 和服务器 B，A 和 B 在两个不同的网段，没法通过 ssh 或者 ftp 直接连接上。如何将放在 A 上的 git 仓库数据每隔一天备份并存储到 B 上? linux 定时脚本我使用的是crontab包，登录服务器 A，检查crontab并将crontab设置为开机">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2020-01-15T06:30:09.116Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="如何写一个定时执行的shell脚本">
<meta name="twitter:description" content="前言需求是需要对放在测试服务器的 git 仓库定期做好备份，防止测试服务器有天挂掉了数据会丢失掉。假设现在有两台服务器–服务器 A 和服务器 B，A 和 B 在两个不同的网段，没法通过 ssh 或者 ftp 直接连接上。如何将放在 A 上的 git 仓库数据每隔一天备份并存储到 B 上? linux 定时脚本我使用的是crontab包，登录服务器 A，检查crontab并将crontab设置为开机">
    
    
        
          
              <link rel="shortcut icon" href="/images/favicon.ico">
          
        
        
          
            <link rel="icon" type="image/png" href="/images/favicon-192x192.png" sizes="192x192">
          
        
        
          
            <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
          
        
    
    <!-- title -->
    <title>如何写一个定时执行的shell脚本</title>
    <!-- styles -->
    <link rel="stylesheet" href="/css/style.css">
    <!-- persian styles -->
    
      <link rel="stylesheet" href="/css/rtl.css">
    
    <!-- rss -->
    
    
</head>

<body class="max-width mx-auto px3 ltr">
    
      <div id="header-post">
  <a id="menu-icon" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="menu-icon-tablet" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="top-icon-tablet" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');" style="display:none;"><i class="fas fa-chevron-up fa-lg"></i></a>
  <span id="menu">
    <span id="nav">
      <ul>
         
          <li><a href="/">首页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/others/">其他文章</a></li>
        
      </ul>
    </span>
    <br/>
    <span id="actions">
      <ul>
        
        <li><a class="icon" href="/2018/05/07/koa_static_file_server/"><i class="fas fa-chevron-left" aria-hidden="true" onmouseover="$('#i-prev').toggle();" onmouseout="$('#i-prev').toggle();"></i></a></li>
        
        
        <li><a class="icon" href="/2018/04/28/travis_node_publish2/"><i class="fas fa-chevron-right" aria-hidden="true" onmouseover="$('#i-next').toggle();" onmouseout="$('#i-next').toggle();"></i></a></li>
        
        <li><a class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up" aria-hidden="true" onmouseover="$('#i-top').toggle();" onmouseout="$('#i-top').toggle();"></i></a></li>
        <li><a class="icon" href="#"><i class="fas fa-share-alt" aria-hidden="true" onmouseover="$('#i-share').toggle();" onmouseout="$('#i-share').toggle();" onclick="$('#share').toggle();return false;"></i></a></li>
      </ul>
      <span id="i-prev" class="info" style="display:none;">上一篇</span>
      <span id="i-next" class="info" style="display:none;">下一篇</span>
      <span id="i-top" class="info" style="display:none;">返回顶部</span>
      <span id="i-share" class="info" style="display:none;">分享文章</span>
    </span>
    <br/>
    <div id="share" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/"><i class="fab fa-facebook " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&text=如何写一个定时执行的shell脚本"><i class="fab fa-twitter " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&title=如何写一个定时执行的shell脚本"><i class="fab fa-linkedin " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&is_video=false&description=如何写一个定时执行的shell脚本"><i class="fab fa-pinterest " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=如何写一个定时执行的shell脚本&body=Check out this article: https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/"><i class="fas fa-envelope " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&title=如何写一个定时执行的shell脚本"><i class="fab fa-get-pocket " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&title=如何写一个定时执行的shell脚本"><i class="fab fa-reddit " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&title=如何写一个定时执行的shell脚本"><i class="fab fa-stumbleupon " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&title=如何写一个定时执行的shell脚本"><i class="fab fa-digg " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&name=如何写一个定时执行的shell脚本&description="><i class="fab fa-tumblr " aria-hidden="true"></i></a></li>
</ul>

    </div>
    <div id="toc">
      <ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#前言"><span class="toc-number">1.</span> <span class="toc-text">前言</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#linux-定时脚本"><span class="toc-number">2.</span> <span class="toc-text">linux 定时脚本</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#如何实现两台服务器数据互传"><span class="toc-number">3.</span> <span class="toc-text">如何实现两台服务器数据互传</span></a></li></ol>
    </div>
  </span>
</div>

    
    <div class="content index py4">
        
        <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
  <header>
    
    <h1 class="posttitle" itemprop="name headline">
        如何写一个定时执行的shell脚本
    </h1>



    <div class="meta">
      <span class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">
        <span itemprop="name">月光倾城的代码小屋</span>
      </span>
      
    <div class="postdate">
        <time datetime="2018-05-03T13:44:39.000Z" itemprop="datePublished">2018-05-03</time>
    </div>


      

      
    <div class="article-tag">
        <i class="fas fa-tag"></i>
        <a class="tag-link" href="/tags/linux/">linux</a>, <a class="tag-link" href="/tags/同花顺/">同花顺</a>
    </div>


    </div>
  </header>
  

  <div class="content" itemprop="articleBody">
    <h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><p>需求是需要对放在测试服务器的 git 仓库定期做好备份，防止测试服务器有天挂掉了数据会丢失掉。假设现在有两台服务器–服务器 A 和服务器 B，A 和 B 在两个不同的网段，没法通过 ssh 或者 ftp 直接连接上。如何将放在 A 上的 git 仓库数据每隔一天备份并存储到 B 上?</p>
<h3 id="linux-定时脚本"><a href="#linux-定时脚本" class="headerlink" title="linux 定时脚本"></a>linux 定时脚本</h3><p>我使用的是<code>crontab</code>包，登录服务器 A，检查<code>crontab</code>并将<code>crontab</code>设置为开机自启。</p>
<figure class="highlight applescript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 查看crontab的版本，如果没有安装就去安装下</span></span><br><span class="line">crontab -v</span><br><span class="line"><span class="comment"># 使用chkconfig设置crontab为开机启动启动，ubuntu好像默认不支持这个工具，自己安装咯</span></span><br><span class="line">chkconfig crond <span class="keyword">on</span></span><br></pre></td></tr></table></figure>
<p><code>crontab</code>命令说明如下：</p>
<ul>
<li>-e：编辑该用户的计时器设置；</li>
<li>-l：列出该用户的计时器设置；</li>
<li>-r：删除该用户的计时器设置；</li>
<li>-u &lt;用户名称&gt;：指定要设定计时器的用户名称。</li>
</ul>
<p><code>crontab</code>定时任务语法如下:</p>
<figure class="highlight excel"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">minute</span>   <span class="built_in">hour</span>   <span class="built_in">day</span>   <span class="built_in">month</span>   week   command     顺序：分 时 日 月 周</span><br></pre></td></tr></table></figure>
<p>说明</p>
<ul>
<li>minute： 表示分钟，可以是从 0 到 59 之间的任何整数。</li>
<li>hour：表示小时，可以是从 0 到 23 之间的任何整数。</li>
<li>day：表示日期，可以是从 1 到 31 之间的任何整数。</li>
<li>month：表示月份，可以是从 1 到 12 之间的任何整数。</li>
<li>week：表示星期几，可以是从 0 到 7 之间的任何整数，这里的 0 或 7 代表星期日。</li>
<li>command：要执行的命令，可以是系统命令，也可以是自己编写的脚本文件。</li>
</ul>
<p>在以上各个字段中，还可以使用以下特殊字符：</p>
<ul>
<li>星号（*）：代表所有可能的值，例如 month 字段如果是星号，则表示在满足其它字段的制约条件后每月都执行该命令操作。</li>
<li>逗号（,）：可以用逗号隔开的值指定一个列表范围，例如，“1,2,5,7,8,9”</li>
<li>中杠（-）：可以用整数之间的中杠表示一个整数范围，例如“2-6”表示“2,3,4,5,6”</li>
<li>正斜线（/）：可以用正斜线指定时间的间隔频率，例如“0-23/2”表示每两小时执行一次。同时正斜线可以和星号一起使用，例如*/10，如果用在 minute 字段，表示每十分钟执行一次。</li>
</ul>
<p>详情请参考<a href="http://wangchujiang.com/linux-command/c/crontab.html" target="_blank" rel="noopener">这里</a><br>如此，我要设计每天凌晨执行一次脚本，<code>crontab</code>的任务就应该这么写：</p>
<figure class="highlight basic"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="symbol">0 </span><span class="number">0</span> * * * /xxx/backup.sh</span><br></pre></td></tr></table></figure>
<h3 id="如何实现两台服务器数据互传"><a href="#如何实现两台服务器数据互传" class="headerlink" title="如何实现两台服务器数据互传"></a>如何实现两台服务器数据互传</h3><p>我是借助了搭建在 A 服务器上的一个名为<code>kodexplorer</code>的文件上传工具实现的，先将备份好的文件移动到<code>kodexplorer</code>的目录下，然后就能拿到一个外网可访问的地址，B 服务器下通过 wget 就能下载到备份的文件。比如 A 在凌晨整点做了备份，B 就可以在凌晨过 10 分去下载 A 备份好的文件具体的<code>shell</code>代码如下:</p>
<p><strong>跑在 A 服务器上的 shell 脚本</strong></p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#!/bin/bash</span></span><br><span class="line"><span class="built_in">cd</span> /root/go18/src/github.com/gogits/gogs/</span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">"\n\n\nbackup started..."</span> &gt;&gt; ./backup.log</span><br><span class="line"><span class="comment"># shell新建变量的语法，=前后不能有空格</span></span><br><span class="line">DATE_N=`date <span class="string">"+%Y-%m-%d %H:%M:%S"</span>`</span><br><span class="line">USER_N=`whoami`</span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">"Date and runner info: <span class="variable">$&#123;DATE_N&#125;</span> <span class="variable">$&#123;USER_N&#125;</span>"</span> &gt;&gt; ./backup.log</span><br><span class="line"><span class="comment"># 执行备份</span></span><br><span class="line">./gogs backup</span><br><span class="line"><span class="comment"># 使用$?判断上一步的备份是否执行成功</span></span><br><span class="line"><span class="keyword">if</span> [ $? -eq 0 ]; <span class="keyword">then</span></span><br><span class="line">    <span class="built_in">echo</span> <span class="string">"backup success"</span> &gt;&gt; ./backup.log</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line">    <span class="built_in">echo</span> <span class="string">"backup failed"</span> &gt;&gt; ./backup.log</span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"><span class="comment"># 重命名新建的备份文件，并将其移动到kodexplorer的目录下</span></span><br><span class="line">mv gogs-backup-* gogs-backup.zip</span><br><span class="line">mv gogs-backup.zip /home/wwwroot/kodexplorer/data/User/lidikang/home/gogs_backup</span><br><span class="line"><span class="built_in">echo</span> <span class="string">"backup ended..."</span> &gt;&gt; ./backup.log</span><br><span class="line"><span class="built_in">exit</span> 0</span><br></pre></td></tr></table></figure>
<p><strong>跑在 B 服务器上的 shell 脚本</strong></p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#!/bin/bash</span></span><br><span class="line"><span class="built_in">cd</span> /root/gogs_backup</span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">"\n\n\n backup started..."</span> &gt;&gt; ./backup.log</span><br><span class="line">DATE_N=`date <span class="string">"+%Y-%m-%d %H:%M:%S"</span>`</span><br><span class="line">DATE_NAME=`date <span class="string">"+%Y-%m-%d-%H-%M-%s"</span>`</span><br><span class="line">USER_N=`whoami`</span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">"Date and runner info: <span class="variable">$&#123;DATE_N&#125;</span> <span class="variable">$&#123;USER_N&#125;</span>"</span> &gt;&gt; ./backup.log</span><br><span class="line">wget https://khtest.10jqka.com.cn/dev/lidikang/gogs_backup/gogs-backup.zip</span><br><span class="line"><span class="keyword">if</span> [ $? -eq 0 ]; <span class="keyword">then</span></span><br><span class="line">    <span class="built_in">echo</span> <span class="string">"download success"</span> &gt;&gt; ./backup.log</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line">    <span class="built_in">echo</span> <span class="string">"download failed"</span> &gt;&gt; ./backup.log</span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line">mv gogs-backup.zip <span class="string">"gogs-backup-"</span><span class="string">"<span class="variable">$DATE_NAME</span>"</span><span class="string">".zip"</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"backup ended..."</span> &gt;&gt; ./backup.log</span><br><span class="line"><span class="built_in">exit</span> 0</span><br></pre></td></tr></table></figure>
<p>提一下，新建的 shell 记得添加可执行权限。</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">chmod</span> +<span class="selector-tag">x</span> <span class="selector-tag">xxx</span><span class="selector-class">.sh</span></span><br></pre></td></tr></table></figure>

  </div>
  <div class="statement">
    <hr>  
    1. 如果本文帮到了您，不妨点一下右上角的”<i class="fas fa-share-alt"></i>“按钮。<br>
    2. 除非注明，本博文章均为原创，转载请以链接形式标明本文地址。<br>
    3. 如果你有任何疑问，欢迎发送邮件到我的邮箱<a href="mailto:andyliwr@outlook.com">andyliwr@outlook.com<br>
  </div>
</article>


    <div class="blog-post-comments">
        <div id="gitalk_thread">
            <noscript>加载评论需要在浏览器启用 JavaScript 脚本支持。</noscript>
        </div>
    </div>



        
          <div id="footer-post-container">
  <div id="footer-post">

    <div id="nav-footer" style="display: none">
      <ul>
         
          <li><a href="/">首页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/others/">其他文章</a></li>
        
      </ul>
    </div>

    <div id="toc-footer" style="display: none">
      <ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#前言"><span class="toc-number">1.</span> <span class="toc-text">前言</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#linux-定时脚本"><span class="toc-number">2.</span> <span class="toc-text">linux 定时脚本</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#如何实现两台服务器数据互传"><span class="toc-number">3.</span> <span class="toc-text">如何实现两台服务器数据互传</span></a></li></ol>
    </div>

    <div id="share-footer" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/"><i class="fab fa-facebook fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&text=如何写一个定时执行的shell脚本"><i class="fab fa-twitter fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&title=如何写一个定时执行的shell脚本"><i class="fab fa-linkedin fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&is_video=false&description=如何写一个定时执行的shell脚本"><i class="fab fa-pinterest fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=如何写一个定时执行的shell脚本&body=Check out this article: https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/"><i class="fas fa-envelope fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&title=如何写一个定时执行的shell脚本"><i class="fab fa-get-pocket fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&title=如何写一个定时执行的shell脚本"><i class="fab fa-reddit fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&title=如何写一个定时执行的shell脚本"><i class="fab fa-stumbleupon fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&title=如何写一个定时执行的shell脚本"><i class="fab fa-digg fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=https://andyliwr.github.io/2018/05/03/how_to_write_a_timed_shell/&name=如何写一个定时执行的shell脚本&description="><i class="fab fa-tumblr fa-lg" aria-hidden="true"></i></a></li>
</ul>

    </div>

    <div id="actions-footer">
        <a id="menu" class="icon" href="#" onclick="$('#nav-footer').toggle();return false;"><i class="fas fa-bars fa-lg" aria-hidden="true"></i> 菜单</a>
        <a id="toc" class="icon" href="#" onclick="$('#toc-footer').toggle();return false;"><i class="fas fa-list fa-lg" aria-hidden="true"></i> 目录</a>
        <a id="share" class="icon" href="#" onclick="$('#share-footer').toggle();return false;"><i class="fas fa-share-alt fa-lg" aria-hidden="true"></i> 分享</a>
        <a id="top" style="display:none" class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up fa-lg" aria-hidden="true"></i> 返回顶部</a>
    </div>

  </div>
</div>

        
        <footer id="footer">
  <div class="footer-left">
    Copyright &copy; 2020 Dikang Li
  </div>
  <div class="footer-right">
    <nav>
      <ul>
         
          <li><a href="/">首页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/others/">其他文章</a></li>
        
      </ul>
    </nav>
  </div>
</footer>

    </div>
</body>
</html>
<!-- styles -->
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
<link rel="stylesheet" href="/lib/justified-gallery/css/justifiedGallery.min.css">
<link rel="stylesheet" href="/lib/fancybox/jquery.fancybox.css">

<link rel="stylesheet" href="https://file.lantingshucheng.com/blog/v3/static/styles/gitalk.css">


<!-- jquery -->
<script src="/lib/jquery/jquery.min.js"></script>
<script src="/lib/justified-gallery/js/jquery.justifiedGallery.min.js"></script>
<script src="/lib/fancybox/jquery.fancybox.pack.js"></script>

<script type="text/javascript" src="https://file.lantingshucheng.com/blog/v3/static/scripts/md5.js"></script>
<script type="text/javascript" src="https://file.lantingshucheng.com/blog/v3/static/scripts/gitalk.min.js"></script>

<script src="/js/main.js"></script>
<!-- search -->

<!-- Google Analytics -->

<!-- Baidu Analytics -->

    <script type="text/javascript">
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?7851ca7a86be957be994acb77639a5be";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>

<!-- Disqus Comments -->


  <script type="text/javascript">
    window.onload = function(){
      if (window.location.href.indexOf('andyliwr.github.io') > -1) {
        var gitalk = new Gitalk({
          clientID: 'ad6f70df0c70d2b715f9',
          clientSecret: '40384bee244c1e17dd7c37733d21e9ef669e969c',
          repo: 'Andyliwr.github.io',
          owner: 'Andyliwr',
          admin: ['Andyliwr'],
          id: md5(location.pathname),
          distractionFreeMode: 'true'
        })
        gitalk.render('gitalk_thread')
      }
    }
  </script>


